<template>
	<view class='container bg-w'>
		<view class="header uni-flex uni-row flex-between">
			<uni-nav-bar title="巡查巡检">
				<template slot='left'>
					<view class="flex width-100">
						<i class='iconfont iconfanhui' @click='goBack()'></i>
					</view>
				</template>
				<template slot='right' v-if="!groupId">
					<i class='iconfont iconcaidan right-i'></i>
					<view class="" style="color: #09AAE9;" @click="toInspectionRecord">
						巡检记录
					</view>
				</template>
			</uni-nav-bar>
		</view>
		<view class="position-r-top">
			<view class="main">

				<view class="construction-data">
					<view class="form-list flex flex-between height-50 border-bottom uni-list-cell-navigate uni-navigate-right">
						<text class="color-6 ">项目名</text>
						<input type="text" placeholder="请选择" :disabled="true" v-model="projectName" @click="SelectTemplate" />
					</view>
					<view class="form-list flex flex-between height-50 border-bottom">
						<text class="color-6 ">负责单位</text>
						<input type="text" :disabled="true" v-model="ResponsibleUnit" />
					</view>
					<view class="form-list flex flex-between height-50 border-bottom">
						<text class="color-6 ">位置信息</text>
						<input type="text" :disabled="true" v-model="projectAddress" />
					</view>


					<view class="main" style="margin-top: 20px;">
						<uni-collapse :accordion="true">
							<uni-collapse-item v-for="(item,index) in zdhjcInspectionTasks" :key="index" :title="'巡检子项'+(index+1)" :open="true"
							 :showAnimation="true">
								<view class="uni-list">
									<view class="form-list flex flex-between height-50 border-bottom uni-list-cell-navigate uni-navigate-right">
										<text class="color-6 ">巡检子项</text>
										<input type="text" placeholder="请选择" :disabled="true" v-model="item.subProjectName" @click="SelectSub(index)" />
									</view>
									<view class="form-list flex flex-between height-50 border-bottom uni-list-cell-navigate uni-navigate-right">
										<text class="color-6 ">施工记录</text>
										<view class="color-6 flex algin-i-c">
											<text class="txtCut1" @click="seeConstruction(item)">查看</text>
										</view>
									</view>
									<view class="form-list flex flex-between height-50 border-bottom uni-list-cell-navigate uni-navigate-right">
										<text class="color-6 ">巡检模板</text>
										<input type="text" placeholder="请选择" :disabled="true" v-model="item.inspectionName" @click="TempSelect(index)" />
									</view>
									<view class="uni-list" v-for="(it,listIndex) in item.list" :key="listIndex">
										<view class="form-list flex flex-between height-50 border-bottom">
											<text class="color-6 ">{{it.subInspectionName}}</text>
											<radio-group class="flex flex-center-h" @change="radioChange($event,listIndex,index)">
												<label>
													<radio value="0" :checked="it.state==0" /><text>异常</text>
												</label>
												<label>
													<radio value="1" :checked="it.state==1" /><text>正常</text>
												</label>
											</radio-group>
										</view>

										<view class="form-list flex flex-between height-50 border-bottom">
											<text class="Requirement">
												{{it.subInspectionRequirement}}
											</text>
										</view>
									</view>

									<view class="form-list flex flex-between height-50 border-bottom">
										<text class="color-6 ">备注</text>
										<input type="text" style="text-align: left;" v-model="item.remarks" />
									</view>

									<view class="photograph">
										<view class="photograph-list">
											<view class="flex flex-between margin-b-10">
												<text>上传照片</text>
												<i class='iconfont iconpaizhao fz-22 color-6' @tap="chooseVideoImage(index)"></i>
											</view>
											<view class="photo-list flex flex-between">
												<view class="img_box" v-for="(imgItem,imgIndex) in item.imgUrl" :key="imgIndex">
													<image :src="imgItem" mode="" @click="previewImg(index,imgIndex)"></image>
													<icon type="cancel" size="26" @click="delImgBtn(imgIndex,index)" />
												</view>
											</view>
											<!-- <view class="photo-list flex flex-between"> -->
											<!-- 	<view class="img_box" v-for="(imgItem,imgIndex) in item.videoUrl" :key="imgIndex">
											<video ref="big" id="bigVideoShow" @tap="videobtn" :style="videoWH" :src="imgItem" class="video" :loop="true"
											 :show-center-play-btn='controls' :controls='true' :autoplay="true">
											</video>
											<image :src="imgItem" mode=""></image>
											<icon type="cancel" size="26" @click="delImgBtn(imgIndex,index)" />
										</view>
									</view> -->
										</view>
									</view>

									<view class="del_pro" @click="delPro(index)">
										删除巡检项目
									</view>

								</view>
							</uni-collapse-item>
						</uni-collapse>

						<uni-popup ref="subPopup" type="bottom">
							<view class="screen-popup">
								<view class="screen-popup-title flex flex-between">
									<text class="margin-l-10"> 请选择巡检子项 </text>
									<view class="flex border-left">
										<text @click="close()">取消</text>
										<text @click="ChoiceTemplateSub()">确认</text>
									</view>
								</view>
								<view class="screen-popup-body">
									<uni-search-bar :radius="100" @confirm="searchTemplate" placeholder='请输入子项目名称'></uni-search-bar>
									<view style="text-align:center; padding: 30rpx;" v-if="!subporjectList||!subporjectList.length">
										无子项目
									</view>
									<view class="uni-list" v-else>
										<radio-group @change="proChangeSub">
											<label class="uni-list-cell uni-list-cell-pd flex flex-between border-bottom" v-for="(item, index) in subporjectList"
											 :key="item.id">
												<view class="fz-14">{{item.subProjectName}}</view>
												<view>
													<radio color='#09AAE9' :value="item.subProjectId" :checked="index === current" />
												</view>
											</label>
										</radio-group>
									</view>
								</view>
							</view>
						</uni-popup>

						<!-- 巡检模板 -->
						<uni-popup ref="tempPopup" type="bottom">
							<view class="screen-popup">
								<view class="screen-popup-title flex flex-between">
									<text class="margin-l-10"> 请选择巡检模板 </text>
									<view class="flex border-left">
										<text @click="close()">取消</text>
										<text @click="ChoiceTemplateTemp()">确认</text>
									</view>
								</view>
								<view class="screen-popup-body">
									<uni-search-bar :radius="10" @confirm="searchMubanTemplate" placeholder='请输入模板名称'></uni-search-bar>
									<view class="uni-list">
										<radio-group @change="proChangeTemp">
											<label class="uni-list-cell uni-list-cell-pd flex flex-between border-bottom" v-for="(item, index) in mubanList"
											 :key="item.id">
												<view class="fz-14">{{item.inspectionName}}</view>
												<view>
													<radio color='#09AAE9' :value="item.inspectionId" :checked="index === current" />
												</view>
											</label>
										</radio-group>
									</view>
								</view>
							</view>
						</uni-popup>
					</view>


				</view>

				<view class="">
					<uni-popup ref="popup" type="bottom">
						<view class="screen-popup">
							<view class="screen-popup-title flex flex-between">
								<text class="margin-l-10"> 请选择项目</text>
								<view class="flex border-left">
									<text @click="close()">取消</text>
									<text @click="ChoiceTemplate()">确认</text>
								</view>
							</view>
							<view class="screen-popup-body">
								<uni-search-bar :radius="10" @confirm="searchProTemplate" placeholder='请输入项目名称或编号'></uni-search-bar>
								<view class="uni-list">
									<radio-group @change="proChange">
										<label class="uni-list-cell uni-list-cell-pd flex flex-between border-bottom" v-for="(item, index) in template"
										 :key="item.id">
											<view class="fz-14">{{item.projectName}}</view>
											<view>
												<radio color='#09AAE9' :value="item.projectId" :checked="index === current" />
											</view>
										</label>
									</radio-group>
								</view>
							</view>
						</view>
					</uni-popup>
				</view>
				<view class="addPro" @click="addProject" v-if="addShow">
					添加巡检项目
				</view>
			</view>
			<view class="construction-footer flex">
				<button type="text" @click="$noMultipleClicks(SaveBtn)">保存</button>
				<button type="text" @click="$noMultipleClicks(SubmitBtn)">提交</button>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getProject,
		getProjectInfo,
		getOrgInfo,
		getSubPorject,
		getInspectionTemp,
		saveSubmit,
		upload,
		getmubanInfo,
		getProInfo,
		getFileById,
		getInspectionInfo
	} from "@/common/api/Inspection.js"
	import ipConfig from '@/utils/ipconfig.js'
	export default {
		data() {
			return {
				projectName: null,
				ResponsibleUnit: null,
				projectAddress: null,
				orgId: null,
				zdhjcInspectionTasks: [],
				templateId: null,
				templateName: null,
				subProjectName: null,
				subProjectId: null,
				processId: null,
				inspectionName: null,
				inspectionId: null,
				template: [],
				pageName: null,
				searchMuban: null,
				keyword: null,
				videoWH: {
					'height': '100%',
					'width': '100%',
					'position': 'fixed',
					'top': '0',
					'left': 0,
					'z-index': 9
				},
				current: -1,
				totalPage: 0, //总页数
				subporjectList: [],
				mubanList: [],
				projectId: "",
				selectIndex: null,
				addShow: false,
				flag: true,
				checkFlag: true,
				groupId: "", //继续巡检

				controls: false,

				noClick: true,
				newGroupId: null
			}
		},
		onLoad(option) {
			this.groupId = option.groupId
			this.getProList();
		},
		watch: {
			projectName: {
				immediate: true,
				handler(str) {
					if (str) {
						this.addShow = true
					}
				}
			},
			deep: true,
			groupId: {
				immediate: true,
				handler(val) {
					if (val) {
						getInspectionInfo(val).then(res => {
							// console.log(res.data.list[0].list[0].groupId)
							this.projectName = res.data.projectName;
							this.projectId = res.data.projectId;
							this.ResponsibleUnit = res.data.orgName;
							this.zdhjcInspectionTasks = res.data.list
							getSubPorject({
								projectId: res.data.projectId
							}).then(e => {
								this.subporjectList = [...e.data.records]
							})
							this.zdhjcInspectionTasks.forEach(item => {
								console.log(item.groupId)
								if (!item.imgUrl) {
									this.$set(item, 'imgUrl', [])
								}
								var arr = item.attachmentId.split(",")
								arr.forEach(items => {
									if (items) {
										getFileById(items).then(r => {
											item.imgUrl.push('data:application/force-download;base64,' + uni.arrayBufferToBase64(r))
										})
									}
								})
							})
						})
					}
				}
			},
			deep: true,
		},
		methods: {
			// 提交
			SubmitBtn() {
				this.zdhjcInspectionTasks.forEach(item => {
					delete item.imgUrl;
					this.$set(item, 'status', "1");
					if(this.newGroupId!=null){
						this.$set(item, 'groupId', this.newGroupId);
						item.list.forEach(it=>{
							it.groupId = this.newGroupId
						})
					}
					if (item.inspectionName == null || item.subProjectName == null) {
						this.flag = false;
					} else {
						this.flag = true;
					}
					item.attachmentId = item.attachmentId.toString()
					item.list.forEach(it => {
						delete it.createTime;
						delete it.updateTime;
						delete it.delFlag;
						delete it.createUser;
						delete it.updateUser;
						delete it.imgUrl;
						if (it.state && it.state == "3") {
							this.checkFlag = false;
						} else {
							this.checkFlag = true;
						}
					})
				})
				if (this.zdhjcInspectionTasks.length < 1) {
					uni.showToast({
						title: "请添加子项目",
						icon: 'none',
					})
				} else if (!this.flag) {
					uni.showToast({
						title: "请选择巡检子项或巡检模板",
						icon: 'none',
					})
				} else if (this.checkFlag == false) {
					uni.showToast({
						title: "请选择模板状态",
						icon: 'none',
					})
				} else {
					saveSubmit({
						zdhjcInspectionTasks: this.zdhjcInspectionTasks,
						type: 1
					}).then(res => {
						if (res.code != "20000") {
							uni.showToast({
								title: "提交失败",
								icon: 'none',
							})
						} else if (res.code == "20000") {
							uni.showToast({
								title: "提交成功",
							})
							setTimeout(() => {
								if (this.groupId != undefined) {
									uni.navigateBack({
										delta: 3
									});
								} else {
									uni.navigateBack();
								}
							}, 1000)
						}
					})
				}
			},
			SaveBtn() {
				this.zdhjcInspectionTasks.forEach(item => {
					delete item.imgUrl;
					this.$set(item, 'status', "0");
					if(this.newGroupId!=null){
						this.$set(item, 'groupId', this.newGroupId);
						item.list.forEach(it=>{
							it.groupId = this.newGroupId
						})
					}
					if (item.inspectionName == null || item.subProjectName == null) {
						this.flag = false;
					} else {
						this.flag = true;
					}
					item.attachmentId = item.attachmentId.toString()
					item.list.forEach(it => {
						delete it.createTime;
						delete it.updateTime;
						delete it.delFlag;
						delete it.createUser;
						delete it.updateUser;
						delete it.imgUrl;
						if (it.state && it.state == "3") {
							this.checkFlag = false;
						} else {
							this.checkFlag = true;
						}
					})
				})
				if (this.zdhjcInspectionTasks.length < 1) {
					uni.showToast({
						title: "请添加子项目",
						icon: 'none',
					})
				} else if (!this.flag) {
					uni.showToast({
						title: "请选择巡检子项或巡检模板",
						icon: 'none',
					})
				} else if (this.checkFlag == false) {
					uni.showToast({
						title: "请选择模板状态",
						icon: 'none',
					})
				} else {
					saveSubmit({
						zdhjcInspectionTasks: this.zdhjcInspectionTasks,
						type: 0
					}).then(res => {
						if (res.code != "20000") {
							uni.showToast({
								title: "保存失败",
								icon: 'none',

							})
						} else if (res.code == "20000") {
							uni.showToast({
								title: "保存成功",
							})
							setTimeout(() => {
								if (this.groupId != undefined) {
									uni.navigateBack({
										delta: 3
									});
								} else {
									uni.navigateBack();
								}
							}, 1000)
						}

					})
				}
			},
			radioChange(e, listIndex, index) {
				this.zdhjcInspectionTasks[index].list[listIndex].state = e.detail.value
			},
			getProList() {
				getProject({
					pageNo: 1,
					pageSize: 99999,
					keyword: this.keyword
				}).then(res => {
					this.totalPage = res.data.pages
					this.template = res.data.records
				})
			},
			searchProTemplate(e) {
				this.keyword = e.value;
				this.getProList();
			},
			//项目弹框
			SelectTemplate() {
				this.$refs.popup.open()
			},
			// 选择项目
			proChange(e) {
				this.projectId = e.detail.value;
				this.template.forEach((obj, index) => {
					if (obj.projectId == this.projectId) {
						this.templateName = obj.projectName;
						this.projectId = obj.projectId;
						this.current = -1;
					}
				})
			},
			// 项目确定按钮
			ChoiceTemplate(index) {
				if (this.projectName != this.templateName) {
					this.zdhjcInspectionTasks.forEach(item => {
						item.subProjectName = null;
						item.subProjectId = null;
						item.inspectionTempleteId = null;
						item.inspectionName = null;
						item.list = [];
					})
				}
				this.projectName = this.templateName;
				if (this.projectId) {
					getProjectInfo(this.projectId).then(res => {
						res.data.participates.forEach((item, index) => {
							if (item.type == "355964281813995520") {
								this.ResponsibleUnit = item.orgName;
								this.orgId = item.orgId;
							}
						})
						this.projectAddress = res.data.completeDistrict
					})
					this.getSubData()
				}
				this.$refs.popup.close()
			},
			searchTemplate(e) {
				this.pageName = e.value
				this.getSubData();
			},

			getSubData() {
				getSubPorject({
					projectId: this.projectId,
					pageNo: 1,
					pageSize: 99999,
					subProjectName: this.pageName
				}).then(e => {
					this.subporjectList = [...e.data.records]
				})
			},


			videobtn() { //预览视频
				this.videoStyle = !this.videoStyle
			},

			// 选择子项目
			proChangeSub(e) {
				this.templateId = e.detail.value;
				this.subporjectList.forEach((obj, index) => {
					if (obj.subProjectId == this.templateId) {
						this.subProjectName = obj.subProjectName;
						this.projectName = obj.projectName;
						this.subProjectId = obj.subProjectId;
						this.processId = obj.processId;
						this.current = -1;
					}
				})
			},
			// 子项弹框
			SelectSub(index) {
				this.$refs.subPopup.open();
				this.selectIndex = index;
			},
			// 确定子项目
			ChoiceTemplateSub() {
				this.zdhjcInspectionTasks[this.selectIndex].subProjectName = this.subProjectName;
				this.zdhjcInspectionTasks[this.selectIndex].subProjectId = this.templateId;
				this.zdhjcInspectionTasks[this.selectIndex].projectId = this.projectId;
				this.$refs.subPopup.close()
			},

			searchMubanTemplate(e) {
				this.searchMuban = e.value
				this.getMubanData();
			},

			getMubanData() {
				getInspectionTemp({
					pageNo: 1,
					pageSize: 99999,
					inspectionName: this.searchMuban
				}).then(res => {
					this.totalPage = res.data.pages
					this.mubanList = res.data.records
				})
			},
			// 巡检模板
			TempSelect(index) {
				this.getMubanData();
				this.$refs.tempPopup.open()
				this.selectIndex = index;
			},
			// 选择项目模板
			proChangeTemp(e) {
				this.selectIndex = this.selectIndex;
				this.templateId = e.detail.value;
				this.mubanList.forEach((obj, index) => {
					if (obj.inspectionId == this.templateId) {
						this.inspectionName = obj.inspectionName;
						this.inspectionId = obj.inspectionId
						this.current = -1;
					}
				})

			},
			// 项目模板确定
			ChoiceTemplateTemp() {
				this.zdhjcInspectionTasks[this.selectIndex].inspectionName = this.inspectionName;
				this.zdhjcInspectionTasks[this.selectIndex].inspectionTempleteId = this.inspectionId;
				getmubanInfo(this.inspectionId).then(res => {
					this.zdhjcInspectionTasks[this.selectIndex].list = res.data.list;
					this.zdhjcInspectionTasks[this.selectIndex].list.forEach(item => {
						this.$set(item, 'state', "3");
					})
				})
				this.$refs.tempPopup.close();
			},
			// 删除
			delPro(index) {
				var _this = this
				uni.showModal({
					title: '提示',
					content: '您确定要删除该项目',
					success: function(res) {
						if (res.confirm) {
							_this.zdhjcInspectionTasks.splice(index, 1);
						}
					}
				});
			},


			delImgBtn(imgIndex, index) {
				this.zdhjcInspectionTasks.forEach(item => {
					if (!Array.isArray(item.attachmentId)) {
						item.attachmentId = item.attachmentId.split(",")
					} else {
						return;
					}
				})
				var _this = this;
				uni.showModal({
					title: '提示',
					content: '您确定要删除该照片',
					success: function(res) {
						if (res.confirm) {
							_this.zdhjcInspectionTasks[index].imgUrl.splice(imgIndex, 1)
							_this.zdhjcInspectionTasks[index].attachmentId.splice(imgIndex, 1)
						}
					}
				});
			},
			previewImg(index, imgIndex) {
				uni.previewImage({
					current: imgIndex,
					urls: this.zdhjcInspectionTasks[index].imgUrl
				});
			},

			addProject() {
				var obj = {};
				obj["projectId"] = null;
				obj["subProjectId"] = null;
				obj["inspectionTempleteId"] = null;
				obj["inspectionName"] = null;
				obj["remarks"] = null;
				obj["attachmentId"] = [];
				obj["subProjectName"] = null;
				obj["list"] = [];

				this.zdhjcInspectionTasks.push(obj)
				this.zdhjcInspectionTasks.forEach(item => {
					item.projectId = this.projectId
					if (item.groupId) {
						this.newGroupId = item.groupId
					}
				})
			},

			close() {
				this.$refs.popup.close()
				this.$refs.subPopup.close()
				this.$refs.tempPopup.close()
			},




			toInspectionRecord() {
				uni.navigateTo({
					url: "/pages/Application/Inspection/InspectionProject/InspectionRecord"
				})
			},
			chooseVideoImage(index) {
				this.chooseImages(index)
				// uni.showActionSheet({
				// 	title: "选择上传类型",
				// 	itemList: ['图片', '视频'],
				// 	success: (res) => {
				// 		if (res.tapIndex == 0) {
				// 			this.chooseImages(index)
				// 		} else {
				// 			this.chooseVideo(index)
				// 			// this.videoStyle = false
				// 		}
				// 	}
				// })
			},

			// 上传图片
			chooseImages(index) {
				uni.chooseImage({
					count: 2,
					sizeType: ['compressed'],
					sourceType: ['album', 'camera'],
					success: (res) => {
						let imgSize = 1024 * 1024 * 50
						let time = 10 * 60 * 1000
						if (res.tempFiles[0].path.includes('mp4') == true) {
							uni.showToast({
								title: '不能上传视频，请重新上传',
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: '图片上传中,请等待',
								icon: 'loading',
								duration: 1000
							})
							uni.uploadFile({
								url: ipConfig.ip + 'admin/sys-file/upload',
								filePath: res.tempFilePaths[0],
								name: 'file',
								method: "POST",
								formData: {
									path: 'app'
								},
								header: {
									'Authorization': 'Bearer ' + uni.getStorageSync('token'),
								},
								success: (res) => {
									if (JSON.parse(res.data).code == 20000) {
										setTimeout(() => {
											uni.showToast({
												title: '图片上传成功'
											})
										}, 1000)
										this.zdhjcInspectionTasks.forEach(item => {
											if (!item.imgUrl) {
												this.$set(item, 'imgUrl', [])
											}
											// if (item.attachmentId instanceof Array == false) {
											// 	if (item.attachmentId.length > 0) {
											// 		item.attachmentId = item.attachmentId.replace(/^,+/, "").replace(/,+$/, "");
											// 		item.attachmentId = item.attachmentId.split(",")
											// 	}
											// } else if (item.attachmentId instanceof Array) {
											// 	return;
											// }
											if (Array.isArray(item.attachmentId)) {
												return;
											} else if (!Array.isArray(item.attachmentId)) {
												item.attachmentId = item.attachmentId.replace(/^,+/, "").replace(/,+$/, "");
												item.attachmentId = item.attachmentId.split(",")
											}
										})
										this.zdhjcInspectionTasks[index].attachmentId.push(JSON.parse(res.data).data.id);
										getFileById(JSON.parse(res.data).data.id).then(res => {
											if (this.zdhjcInspectionTasks[index]) {
												this.zdhjcInspectionTasks[index].imgUrl.push('data:application/force-download;base64,' + uni.arrayBufferToBase64(
													res))
											}
										})
									}
								}
							})
						}
					}
				})
			},

			// 上传视频
			chooseVideo(index) {
				uni.chooseVideo({
					maxDuration: 60, //拍摄视频最长60秒
					count: 10,
					camera: 'front',
					sourceType: ['album'],
					success: (res) => {
						// this.isDisable = false
						let videoSize = 1024 * 1024 * 500
						if (res.size > videoSize && res.tempFilePath.includes('mp4')) {
							uni.showToast({
								title: '视频最大上传500M',
								icon: 'none'
							})
						}
						uni.showToast({
							title: '视频上传中,请稍等',
							icon: 'loading',
							// duration: 6000
						})
						uni.uploadFile({
							url: ipConfig.ip + 'admin/sys-file/upload',
							filePath: res.tempFilePath,
							name: 'file',
							method: "POST",
							formData: {
								path: 'app'
							},
							header: {
								'Authorization': 'Bearer ' + uni.getStorageSync('token'),
							},
							success: (res) => {
								if (JSON.parse(res.data).code == 20000) {
									setTimeout(() => {
										this.isDisable = false
										uni.showToast({
											title: '视频上传成功'
										})
									}, 1000)
									this.zdhjcInspectionTasks.forEach(item => {
										if (!item.videoUrl) {
											this.$set(item, 'videoUrl', [])
										}
									})
									getFileById(JSON.parse(res.data).data.id).then(res => {
										if (this.zdhjcInspectionTasks[index]) {
											this.zdhjcInspectionTasks[index].videoUrl.push('data:application/force-download;base64,' + uni.arrayBufferToBase64(
												res))
										}
									})
									// this.zdhjcInspectionTasks.videoUrl.push({
									// 	attachment: JSON.parse(res.data).data.id,
									// 	fileType: 1,
									// 	stepId: item.stepId,
									// })
								} else {
									this.imageList = [];
									uni.showToast({
										title: '视频上传失败',
										icon: 'none'
									})
								}
							},
						})
					}
				})
			},
			/**
			 * 查看施工记录
			 */
			seeConstruction(data){
				if(data.subProjectId && this.processId){
					console.log(this.subProjectId, this.processId, this.projectName)
					uni.navigateTo({
						url: '/pages/Application/ConstructionReport/ConstructionProject/ProjectReport/ProjectReport?subProjectId=' + data.subProjectId + '&processId=' + this.processId + '&projectName=' + this.projectName
					})
				}else{
					uni.showToast({
						title: '请选择子项目',
						icon: 'none'
					})
				}
				
			}
		},
	}
</script>

<style lang="less">
	.container {
		background-color: #F9F9F9;
		display: flex;
		flex-direction: column;
	}

	.main {
		margin-top: 5rpx;
		height: 100%;
		flex: 1;
		overflow: scroll;
	}

	/deep/.uni-collapse .uni-list-cell {
		padding-left: 0 !important;
	}

	/deep/.uni-collapse-cell--open[data-v-8f47561c] {
		background-color: #fff;

	}

	/deep/.uni-collapse-cell[data-v-8f47561c] {
		border-color: #fff;
	}

	.uni-button:after {
		border-radius: 0;
	}

	/deep/.Requirement,
	uni-input {
		color: #666 !important;
	}

	/deep/.uni-navbar--border[data-v-4afea59e] {
		border-bottom-width: 1px;
		border-bottom-style: solid;
		border-bottom-color: #fff;
	}

	.img_box {
		width: 48%;
		position: relative;
	}

	/deep/.uni-label-pointer {
		margin-left: 10rpx;
	}

	/deep/.photograph .photo-list uni-image[data-v-868e4fb2] {
		width: 100% !important;
		height: 220rpx;

	}

	.photograph-list {
		color: #666;
	}

	.img_box uni-icon {
		position: absolute;
		top: 10rpx;
		right: 10rpx;
	}

	/deep/.img_box uni-icon .uni-icon-cancel {
		color: #fff;
	}

	.addPro {
		margin-bottom: 100rpx;
		background-color: #fff;
		line-height: 50px;
		text-align: center;
		position: relative;
		color: #09AAE9;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	uni-input[data-v-868e4fb2] {
		margin-right: 0;
	}

	.del_pro {
		display: flex;
		justify-content: center;
		line-height: 50px;
	}

	/deep/.uni-collapse-cell__title-text[data-v-8f47561c] span {
		margin-left: 16rpx;
	}

	/deep/.uni-collapse-cell__title::before {
		content: " ";
		display: inline-block;
		position: absolute;
		left: 10rpx;
		width: 6px;
		height: 19px;
		border-radius: 2px;
		background-color: #09AAE9;
	}

	.uni-input-wrapper,
	.uni-label-pointer {
		color: #666;
	}

	.photograph {
		padding: 20rpx 3%;

		.photo-list {
			width: 100%;
			margin-top: 20rpx;
			overflow: hidden;
			flex-wrap: wrap;

			// display: grid; /* //网格布局 */
			// grid-template-columns: repeat(auto-fit,minmax(48%,1fr));
			image {
				width: 100%;
				height: 270rpx;
				margin-right: 4%;
				vertical-align: bottom;
				margin-bottom: 20rpx;
				float: left;
			}

			.image-view {
				float: left;
				width: 48%;
				height: 270rpx;
				position: relative;
				margin: 0 0 20rpx 0;
				border: 2rpx solid #ddd;
				box-sizing: border-box;

				image {
					width: 100%;
					height: 220rpx;
					vertical-align: bottom;
					margin-bottom: 0;
				}

				// video{width: 100%;height: 100%;vertical-align: bottom;margin-bottom: 0;}
				/deep/ uni-video {
					width: 100%;
					height: 200rpx;
				}

				/deep/ .del-btn {
					position: absolute;
					bottom: 0;
					width: 100%;
				}
			}

			.image-view:not(:first-child) {
				margin-right: 4%;
			}

			.image-view:nth-child(2n) {
				margin-right: 0;
			}
		}
	}

	/deep/uni-button:after {
		border: none;
		border-radius: none;
	}

	.form-list {
		padding: 0 3%;
		background-color: #fff;
	}

	.screen-popup {
		background-color: #fff;
		min-height: 1000rpx;
		max-height: 1200rpx;

		.screen-popup-title {
			background-color: #f2f2f2;
			height: 100rpx;
			line-height: 100rpx;
			color: #666;

			>view {
				text {
					display: block;
					padding: 0 40rpx;
					line-height: 100rpx;
				}

				text:last-child {
					background-color: #09AAE9;
					color: #fff;
				}
			}
		}
	}

	.screen-popup-body {
		/deep/ .uni-searchbar__box {
			border-color: #eee
		}

		.uni-list {
			max-height: 980rpx;
			overflow-y: auto;

			uni-label {
				padding: 20rpx 3%;
			}
		}
	}

	uni-input {
		height: 100rpx;
		line-height: 100rpx;
		margin-right: 20px;
		text-align: right;
		font-size: 28rpx;
		min-width: 60%;
		max-width: 80%;
	}

	.construction-footer {
		width: -webkit-fill-available;
		height: 100rpx;
		display: flex;
		position: fixed;
		bottom: 0;

		button {
			font-size: 28rpx;
			color: #fff;
			width: 50%;
			line-height: 100rpx;
			border-radius: 0;
		}

		button:first-child {
			background-color: #fff;
			color: #000;
			border-right: 1px solid #fff;
		}

		button:last-child {
			background-color: #09AAE9;
		}
	}
</style>
